{include file="public/head"/} 
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">后台管理</a>
        <a href="">门禁管理中心</a>
        <a><cite>人脸设备管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
      </div>
      <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加设备','{:url('deviceAdd')}',550,550)"><i class="layui-icon"></i>添加设备</button>
        <span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>ID</th>
            <th>小区</th>
            <th>门锁名称</th>
            
            <th>门锁类型</th>
            <th>进出类型</th>
            <th>单元门</th>
            <th>组团</th>
            <th>楼栋</th>
            <th>单元</th>
            <th>序列号</th>
            <th>设备状态</th>
            <th>设备网络状态</th>
            <th>添加时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          {foreach $devicelist as $lis}
          <tr>
            <td>{$lis.id}</td>
            <td>{$lis.community_name}</td>
            <td>{$lis.devicename}</td>
            <td> 
              {if $lis.devicetype == 1}
                小区
              {elseif $lis.devicetype == 2}
                单元门
              {elseif $lis.devicetype == 3}
                电梯门
              {/if}
            </td>
            <td> 
              {if $lis.access_type == 1}
                进
             
              {elseif $lis.access_type ==2}
                出
              {/if}
            </td>
            <td> 
              {if $lis.devicetype == 2||$lis.devicetype == 3}
                {$lis.building}幢{$lis.unit}单元
              
              {/if}
            </td>
            <td>{$lis.group}</td>
            <td>{$lis.building}</td>
            <td>{$lis.unit}</td>
            <td>{$lis.devicekey}</td>
            <td>
             
              {if $lis.state == 1}
                  未绑定
              {elseif $lis.state == 2}
                  已绑定
              {elseif $lis.state == 3}
                  已禁用


              {/if}
            </td>
            <td>
              {if $lis.onlineState == 1}
                  在线
              {elseif $lis.onlineState == 2}
                  离线
              {/if}
            </td>
            <td>{$lis.time}</td>
            <td class="td-manage">
              {if $lis.devicekey == 1}
                  <a title="下线" onclick="lockLower('{$lis.serial}', 'l{$lis.serial}')" href="javascript:;" id="l{$lis.serial}">
                    <i class="layui-icon">&#xe601;</i>
                  </a>
                  <a title="开门" onclick="lockOpen('{$lis.serial}', 'o{$lis.serial}')" href="javascript:;" id="o{$lis.serial}">
                    <i class="layui-icon">&#xe628;</i>
                  </a>
              {elseif $lis.devicekey == 2}
                  <!-- <a title="编辑"  onclick="x_admin_show('编辑','{:url('admin/Lock/lockEdit')}?id={$lis.id}',780,600)" href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>
                  </a> -->
                  <a title="删除" onclick="lockDel('{$lis.devicekey}', 'd{$lis.devicekey}')" href="javascript:;" id="d{$lis.devicekey}">
                    <i class="layui-icon">&#xe640;</i>
                  </a>
                  <a title="上线" onclick="lockUpper('{$lis.devicekey}', 'u{$lis.devicekey}')" href="javascript:;" id="u{$lis.devicekey}">
                    <i class="layui-icon">&#xe62f;</i>
                  </a>
              {/if}
              <a title="开门" onclick="openurl('{$lis.id}')">
                <i class="layui-icon">&#xe628;</i>
              </a>
            </td>
          </tr>
          {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div>
          {$list->render()}
        </div>
      </div>

    </div>
    <script>
        function openurl(id){
            layer.open({
                type: 1,
                skin: 'x-right', //样式类名
                closeBtn: 0, //不显示关闭按钮
                anim: 2,
                shadeClose: true, //开启遮罩关闭
                area: ['80%', '300px'],
                content:
                '<div style="padding: 20px 100px; font-size:18px">'+
                '扫码开门链接：https://www.zhqjw.zfbzhsq.com/api/device/open?id='+ id + '<br><br>'+


                '</div>'
            });
        }
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  </body>

</html>